Skip to content

Improved lib detection: check for matching name in library.properties #1300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2021

Conversation

silvanocerza
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

This PR reintroduces the changes reverted by #1290.

  • What is the current behavior?

Compiling a Sketch that includes OneWire.h for an Arduino Uno while both OneWireNg and OneWire libraries are installed incorrectly compiles using the OneWireNg library.

  • What is the new behavior?

The name set in the library.properties is now also used to understand which library to use for compilation of a Sketch.
This improves library resolution in case multiple libraries have the same header include name but a different library name.

For example compiling a Sketch that includes OneWire.h for an Arduino Uno while both OneWireNg and OneWire libraries are installed will now resolve to OneWire and compile correctly.

No.

  • Other information:

test_compile_with_esp32_bundled_libraries and test_compile_with_esp8266_bundled_libraries have been modified to verify that compilation for those cores fails as expected, they will be reverted to verify compilation works correctly after the libraries bundled with those cores are fixed as defined in #1292.


See how to contribute

@silvanocerza silvanocerza added the type: enhancement Proposed improvement label May 25, 2021
@silvanocerza silvanocerza requested a review from a team May 25, 2021 12:56
@silvanocerza silvanocerza self-assigned this May 25, 2021
…#1276)

* Improved lib detection: check for matching name in library.properties

The library may be stored in a directory that doesn't match the library
name, for example we had a case in the wild where the directories:

   libraries/onewire_2_3_4/...
   libraries/onewireng_1_2_3/...

were used instead of:

   libraries/OneWire/...
   libraries/OneWireNg/...

this lead to incorrect selection of onewireng_1_2_3 when using OneWire.h
(because the OneWireNg had an architecture=avr that had priority over
the architecture=* of onewire_2_3_4).

This commit will restore priority straight.

* Added test for lib resolve improvement

* Lib discovery: always prefer libraries with the correct directory name

* [skip changelog] Add integration test

Co-authored-by: Silvano Cerza <[email protected]>
@silvanocerza silvanocerza force-pushed the scerza/improve-lib-detection branch from a09ff64 to 888a9a3 Compare May 25, 2021 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants